# Maintainer: Alexey Pavlov <Alexpux@gmail.com>

pkgname=elinks-git
_ver_base=0.13
pkgver=0.13.4008.f86be659
pkgrel=7
epoch=
pkgdesc="Full-Featured Text WWW Browser (net-utils)"
arch=("i686" "x86_64")
url="http://elinks.cz/"
license=('GPL')
groups=('net-utils')
depends=('doxygen'
         'gettext'
         'libbz2'
         'libcrypt'
         'libexpat'
         'libffi'
         'libgc'
         'libgcrypt'
         'libgnutls'
         #'libguile'
         'libhogweed'
         'libiconv'
         'libidn'
         'liblzma'
         'libnettle'
         'libp11-kit'
         'libtasn1'
         'libtre'
         'libunistring'
         'perl'
         'python3'
         'xmlto'
         'zlib')
makedepends=('git'
             'gettext-devel'
             #'guile'
             'libbz2-devel'
             'libexpat-devel'
             'libffi-devel'
             'libgc-devel'
             'libgcrypt-devel'
             'libguile-devel'
             'libgnutls-devel'
             'libiconv-devel'
             'libidn-devel'
             'liblzma-devel'
             'libnettle-devel'
             'libp11-kit-devel'
             'libtasn1-devel'
             'libtre-devel'
             'libunistring-devel'
             'perl-devel'
             'python-devel'
             'zlib-devel')
provides=("elinks")
conflicts=("elinks")
source=("${pkgname}"::"git+git://repo.or.cz/elinks.git"
        "msys-platform.patch"
        "cygwin-deprecates.patch")
sha256sums=('SKIP'
            '836437f4421efa3931e8401a7e1044836e7fe1e7016870d685e6992c71dc695c'
            'dff243381d711e533eef9f75c861900783c0fe702697baa672cfaa67755a6ab8')

pkgver() {
  cd ${srcdir}/${pkgname}
  printf "%s.%s.%s" "$_ver_base" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd ${srcdir}/${pkgname}
  patch -p1 -i ${srcdir}/msys-platform.patch
  patch -p1 -i ${srcdir}/cygwin-deprecates.patch
  ./autogen.sh
}

build() {
  cd ${srcdir}/${pkgname}
  export PYTHON=/usr/bin/python3
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --build=${CHOST} \
    --without-openssl \
    --with-lzma \
    --without-guile \
    --with-perl \
    --with-python \
    --without-lua
  make -j1
}

check() {
  cd ${srcdir}/${pkgname}
  make -j1 -k check
}

package() {
  cd ${srcdir}/${pkgname}
  make -j1 DESTDIR="$pkgdir/" install
  rm -f $pkgdir/usr/share/locale/locale.alias
  rm -f $pkgdir/usr/lib/charset.alias
}
